package com.liu.dao;

import java.sql.SQLException;
import java.util.List;

/**
 * @Author 老刘Matthew
 * @Timestamp 2022/7/13 22:32
 * @Description
 */
public interface IGenericDao<T> {

    default String appendWhere(String where) {
        return where == null || where.isEmpty() ? //
                "" : where;
    }

    public Integer save(T t) throws SQLException;

    public Integer update(T t) throws SQLException;

    public List<T> query(String where) throws SQLException;

    public List<T> queryAll() throws SQLException;

    public T querySingle(Integer id) throws SQLException;

    public Integer queryCount(String table, String where) throws SQLException;

}
